'use strict';

const Controller = require('egg').Controller;

class ConfigController extends Controller {
  async index() {
    const config = await this.ctx.model.Config.findById(this.ctx.params.id, {
      raw: true,
    });
    if (config && config.type === 'html') {
      await this.ctx.render('config.njk', config);
    } else {
      this.ctx.status = 403;
    }
  }
}

module.exports = ConfigController;
